{
  "cells": [
    {
      "attachments": {},
      "cell_type": "markdown",
      "metadata": {
        "id": "Rhm7khm6GskV"
      },
      "source": [
        "# Example For running ASR and TTS"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "Cj2x80SegRzr",
        "outputId": "00f9f833-3ff1-4736-e170-136875b88299"
      },
      "outputs": [],
      "source": [
        "# create temporal directory\n",
        "!mkdir \"temp_dir\"\n",
        "!mkdir \"checkpoint\"\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 23,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "cnim4bokprbB",
        "outputId": "f63ed14f-0bde-4517-ee7b-200ddcc45e5f"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "ffmpeg version 3.4.11-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers\n",
            "  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)\n",
            "  configuration: --prefix=/usr --extra-version=0ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared\n",
            "  libavutil      55. 78.100 / 55. 78.100\n",
            "  libavcodec     57.107.100 / 57.107.100\n",
            "  libavformat    57. 83.100 / 57. 83.100\n",
            "  libavdevice    57. 10.100 / 57. 10.100\n",
            "  libavfilter     6.107.100 /  6.107.100\n",
            "  libavresample   3.  7.  0 /  3.  7.  0\n",
            "  libswscale      4.  8.100 /  4.  8.100\n",
            "  libswresample   2.  9.100 /  2.  9.100\n",
            "  libpostproc    54.  7.100 / 54.  7.100\n",
            "\u001b[0;33mGuessed Channel Layout for Input Stream #0.0 : mono\n",
            "\u001b[0mInput #0, wav, from './audio_samples/F001_001.wav':\n",
            "  Duration: 00:00:08.30, bitrate: 256 kb/s\n",
            "    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono, s16, 256 kb/s\n",
            "Stream mapping:\n",
            "  Stream #0:0 -> #0:0 (pcm_s16le (native) -> pcm_s16le (native))\n",
            "Press [q] to stop, [?] for help\n",
            "Output #0, wav, to './audio_samples/F001_0011.wav':\n",
            "  Metadata:\n",
            "    ISFT            : Lavf57.83.100\n",
            "    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 16000 Hz, mono, s16, 256 kb/s\n",
            "    Metadata:\n",
            "      encoder         : Lavc57.107.100 pcm_s16le\n",
            "size=     259kB time=00:00:08.30 bitrate= 256.1kbits/s speed=1.71e+03x    \n",
            "video:0kB audio:259kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.029367%\n"
          ]
        }
      ],
      "source": [
        "# convert audio to 16kHz\n",
        "!ffmpeg -y -i ./audio_samples/F001_001.wav -ar 16000 ./audio_samples/F001_0011.wav"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 5,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "J8N1RKtBiw5V",
        "outputId": "db5d3575-bd21-470d-bb4d-e080e8cece50"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            ">>> preparing tmp manifest dir ...\n",
            ">>> loading model & running inference ...\n",
            "[2023-06-12 17:03:35,323][HYDRA] Launching 1 jobs locally\n",
            "[2023-06-12 17:03:35,323][HYDRA] \t#0 : decoding.type=viterbi dataset.max_tokens=1440000 distributed_training.distributed_world_size=1 common_eval.path='/home/zzy/mms1b_all.pt' task.data=/home/zzy/Uyghur-Translator/temp_dir/tmp3ie85buc dataset.gen_subset=uig-script_arabic:dev common_eval.post_process=letter decoding.results_path=/home/zzy/Uyghur-Translator/temp_dir/tmp3ie85buc\n",
            "[2023-06-12 17:03:35,816][__main__][INFO] - /home/zzy/mms1b_all.pt\n",
            "finish load models\n",
            "[2023-06-12 17:04:40,615][__main__][INFO] - >>> LOADING ADAPTER: uig-script_arabic\n",
            "[2023-06-12 17:04:40,657][fairseq.data.audio.raw_audio_dataset][INFO] - loaded 1, skipped 0 samples\n",
            "[2023-06-12 17:04:40,878][fairseq.tasks.fairseq_task][INFO] - can_reuse_epoch_itr = True\n",
            "[2023-06-12 17:04:40,879][fairseq.tasks.fairseq_task][INFO] - reuse_dataloader = True\n",
            "[2023-06-12 17:04:40,879][fairseq.tasks.fairseq_task][INFO] - rebuild_batches = True\n",
            "[2023-06-12 17:04:40,879][fairseq.tasks.fairseq_task][INFO] - batches will be rebuilt for each epoch\n",
            "[2023-06-12 17:04:40,879][fairseq.tasks.fairseq_task][INFO] - creating new batches for epoch 1\n",
            "[2023-06-12 17:04:45,173][__main__][INFO] - HYPO: بولىدۇ بىز سىزنىڭ يېقىمدىن بۇيان قىلىۋاتقان ئىشىمۇ توغرىسىدا پارانلىشايلى خىزمەتمۇ ياكى ئۆگىنىشمۇ ياكى تۇڭۇشلىكى قىزقارلىق ئىشلارمۇ ياكى سىز يېقىندا قايسى قىزقارلىق كىنۇلارنى كۆتىڭىز ياكى قايسى كىشىنى ۋەپتىن قىلىدىغان كىتابلارنى ئوقۇدىڭىز ياكى سىزنىڭ بىرەر قىزقارلىق قىزغىشىڭىز ۋە كەچۈۋىمىشىڭىز با ئورتاقلىشنى خالامسىز بىز بۇ تېملارنى چىقىش قىلىپ بۇ مەنىلىك قىزقارلىق مىنۇپلارنى بىرلىكتە ئۆتكۈزسەك بولىدۇ\n",
            "[2023-06-12 17:04:45,173][__main__][INFO] - REF: <unk><unk><unk><unk><unk> <unk><unk><unk><unk><unk>\n",
            "[2023-06-12 17:04:45,173][__main__][INFO] - ---------------------\n",
            "[2023-06-12 17:04:45,174][__main__][INFO] - Processed 1 sentences (405 tokens) in 3.6s 0.28 sentences per second, 113.02 tokens per second)\n",
            "[2023-06-12 17:04:45,186][__main__][INFO] - Word error rate: 2600.0000\n",
            "===============\n",
            "Input: /home/zzy/Uyghur-Translator/fairseq/example.wav\n",
            "Output: بولىدۇ بىز سىزنىڭ يېقىمدىن بۇيان قىلىۋاتقان ئىشىمۇ توغرىسىدا پارانلىشايلى خىزمەتمۇ ياكى ئۆگىنىشمۇ ياكى تۇڭۇشلىكى قىزقارلىق ئىشلارمۇ ياكى سىز يېقىندا قايسى قىزقارلىق كىنۇلارنى كۆتىڭىز ياكى قايسى كىشىنى ۋەپتىن قىلىدىغان كىتابلارنى ئوقۇدىڭىز ياكى سىزنىڭ بىرەر قىزقارلىق قىزغىشىڭىز ۋە كەچۈۋىمىشىڭىز با ئورتاقلىشنى خالامسىز بىز بۇ تېملارنى چىقىش قىلىپ بۇ مەنىلىك قىزقارلىق مىنۇپلارنى بىرلىكتە ئۆتكۈزسەك بولىدۇ\n"
          ]
        }
      ],
      "source": [
        "import os\n",
        "os.environ[\"TMPDIR\"] = './temp_dir'\n",
        "os.environ[\"PREFIX\"] = \"INFER\"\n",
        "os.environ[\"HYDRA_FULL_ERROR\"] = \"1\"\n",
        "os.environ[\"USER\"] = \"zzy\"\n",
        "# run ASR inference\n",
        "# --lang uig-script_arabic\n",
        "# --model your model path\n",
        "# --audio your audio path\n",
        "!python infer/mms_infer.py --model \"/home/zzy/mms1b_all.pt\" --lang \"uig-script_arabic\" --audio \"/home/zzy/Uyghur-Translator/fairseq/example.wav\""
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 27,
      "metadata": {},
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "DEBUG:numba.core.byteflow:bytecode dump:\n",
            ">          0\tNOP(arg=None, lineno=1054)\n",
            "           2\tLOAD_FAST(arg=0, lineno=1054)\n",
            "           4\tLOAD_CONST(arg=1, lineno=1054)\n",
            "           6\tBINARY_SUBSCR(arg=None, lineno=1054)\n",
            "           8\tLOAD_FAST(arg=0, lineno=1054)\n",
            "          10\tLOAD_CONST(arg=2, lineno=1054)\n",
            "          12\tBINARY_SUBSCR(arg=None, lineno=1054)\n",
            "          14\tCOMPARE_OP(arg=4, lineno=1054)\n",
            "          16\tLOAD_FAST(arg=0, lineno=1054)\n",
            "          18\tLOAD_CONST(arg=1, lineno=1054)\n",
            "          20\tBINARY_SUBSCR(arg=None, lineno=1054)\n",
            "          22\tLOAD_FAST(arg=0, lineno=1054)\n",
            "          24\tLOAD_CONST(arg=3, lineno=1054)\n",
            "          26\tBINARY_SUBSCR(arg=None, lineno=1054)\n",
            "          28\tCOMPARE_OP(arg=5, lineno=1054)\n",
            "          30\tBINARY_AND(arg=None, lineno=1054)\n",
            "          32\tRETURN_VALUE(arg=None, lineno=1054)\n",
            "DEBUG:numba.core.byteflow:pending: deque([State(pc_initial=0 nstack_initial=0)])\n",
            "DEBUG:numba.core.byteflow:stack: []\n",
            "DEBUG:numba.core.byteflow:dispatch pc=0, inst=NOP(arg=None, lineno=1054)\n",
            "DEBUG:numba.core.byteflow:stack []\n",
            "DEBUG:numba.core.byteflow:dispatch pc=2, inst=LOAD_FAST(arg=0, lineno=1054)\n",
            "DEBUG:numba.core.byteflow:stack []\n",
            "DEBUG:numba.core.byteflow:dispatch pc=4, inst=LOAD_CONST(arg=1, lineno=1054)\n",
            "DEBUG:numba.core.byteflow:stack ['$x2.0']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=6, inst=BINARY_SUBSCR(arg=None, lineno=1054)\n",
            "DEBUG:numba.core.byteflow:stack ['$x2.0', '$const4.1']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=8, inst=LOAD_FAST(arg=0, lineno=1054)\n",
            "DEBUG:numba.core.byteflow:stack ['$6binary_subscr.2']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=10, inst=LOAD_CONST(arg=2, lineno=1054)\n",
            "DEBUG:numba.core.byteflow:stack ['$6binary_subscr.2', '$x8.3']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=12, inst=BINARY_SUBSCR(arg=None, lineno=1054)\n",
            "DEBUG:numba.core.byteflow:stack ['$6binary_subscr.2', '$x8.3', '$const10.4']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=14, inst=COMPARE_OP(arg=4, lineno=1054)\n",
            "DEBUG:numba.core.byteflow:stack ['$6binary_subscr.2', '$12binary_subscr.5']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=16, inst=LOAD_FAST(arg=0, lineno=1054)\n",
            "DEBUG:numba.core.byteflow:stack ['$14compare_op.6']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=18, inst=LOAD_CONST(arg=1, lineno=1054)\n",
            "DEBUG:numba.core.byteflow:stack ['$14compare_op.6', '$x16.7']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=20, inst=BINARY_SUBSCR(arg=None, lineno=1054)\n",
            "DEBUG:numba.core.byteflow:stack ['$14compare_op.6', '$x16.7', '$const18.8']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=22, inst=LOAD_FAST(arg=0, lineno=1054)\n",
            "DEBUG:numba.core.byteflow:stack ['$14compare_op.6', '$20binary_subscr.9']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=24, inst=LOAD_CONST(arg=3, lineno=1054)\n",
            "DEBUG:numba.core.byteflow:stack ['$14compare_op.6', '$20binary_subscr.9', '$x22.10']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=26, inst=BINARY_SUBSCR(arg=None, lineno=1054)\n",
            "DEBUG:numba.core.byteflow:stack ['$14compare_op.6', '$20binary_subscr.9', '$x22.10', '$const24.11']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=28, inst=COMPARE_OP(arg=5, lineno=1054)\n",
            "DEBUG:numba.core.byteflow:stack ['$14compare_op.6', '$20binary_subscr.9', '$26binary_subscr.12']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=30, inst=BINARY_AND(arg=None, lineno=1054)\n",
            "DEBUG:numba.core.byteflow:stack ['$14compare_op.6', '$28compare_op.13']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=32, inst=RETURN_VALUE(arg=None, lineno=1054)\n",
            "DEBUG:numba.core.byteflow:stack ['$30binary_and.14']\n",
            "DEBUG:numba.core.byteflow:end state. edges=[]\n",
            "DEBUG:numba.core.byteflow:-------------------------Prune PHIs-------------------------\n",
            "DEBUG:numba.core.byteflow:Used_phis: defaultdict(<class 'set'>, {State(pc_initial=0 nstack_initial=0): set()})\n",
            "DEBUG:numba.core.byteflow:defmap: {}\n",
            "DEBUG:numba.core.byteflow:phismap: defaultdict(<class 'set'>, {})\n",
            "DEBUG:numba.core.byteflow:changing phismap: defaultdict(<class 'set'>, {})\n",
            "DEBUG:numba.core.byteflow:keep phismap: {}\n",
            "DEBUG:numba.core.byteflow:new_out: defaultdict(<class 'dict'>, {})\n",
            "DEBUG:numba.core.byteflow:----------------------DONE Prune PHIs-----------------------\n",
            "DEBUG:numba.core.byteflow:block_infos State(pc_initial=0 nstack_initial=0):\n",
            "AdaptBlockInfo(insts=((0, {}), (2, {'res': '$x2.0'}), (4, {'res': '$const4.1'}), (6, {'index': '$const4.1', 'target': '$x2.0', 'res': '$6binary_subscr.2'}), (8, {'res': '$x8.3'}), (10, {'res': '$const10.4'}), (12, {'index': '$const10.4', 'target': '$x8.3', 'res': '$12binary_subscr.5'}), (14, {'lhs': '$6binary_subscr.2', 'rhs': '$12binary_subscr.5', 'res': '$14compare_op.6'}), (16, {'res': '$x16.7'}), (18, {'res': '$const18.8'}), (20, {'index': '$const18.8', 'target': '$x16.7', 'res': '$20binary_subscr.9'}), (22, {'res': '$x22.10'}), (24, {'res': '$const24.11'}), (26, {'index': '$const24.11', 'target': '$x22.10', 'res': '$26binary_subscr.12'}), (28, {'lhs': '$20binary_subscr.9', 'rhs': '$26binary_subscr.12', 'res': '$28compare_op.13'}), (30, {'lhs': '$14compare_op.6', 'rhs': '$28compare_op.13', 'res': '$30binary_and.14'}), (32, {'retval': '$30binary_and.14', 'castval': '$32return_value.15'})), outgoing_phis={}, blockstack=(), active_try_block=None, outgoing_edgepushed={})\n",
            "DEBUG:numba.core.interpreter:label 0:\n",
            "    x = arg(0, name=x)                       ['x']\n",
            "    $const4.1 = const(int, 0)                ['$const4.1']\n",
            "    $6binary_subscr.2 = getitem(value=x, index=$const4.1, fn=<built-in function getitem>) ['$6binary_subscr.2', '$const4.1', 'x']\n",
            "    $const10.4 = const(int, -1)              ['$const10.4']\n",
            "    $12binary_subscr.5 = getitem(value=x, index=$const10.4, fn=<built-in function getitem>) ['$12binary_subscr.5', '$const10.4', 'x']\n",
            "    $14compare_op.6 = $6binary_subscr.2 > $12binary_subscr.5 ['$12binary_subscr.5', '$14compare_op.6', '$6binary_subscr.2']\n",
            "    $const18.8 = const(int, 0)               ['$const18.8']\n",
            "    $20binary_subscr.9 = getitem(value=x, index=$const18.8, fn=<built-in function getitem>) ['$20binary_subscr.9', '$const18.8', 'x']\n",
            "    $const24.11 = const(int, 1)              ['$const24.11']\n",
            "    $26binary_subscr.12 = getitem(value=x, index=$const24.11, fn=<built-in function getitem>) ['$26binary_subscr.12', '$const24.11', 'x']\n",
            "    $28compare_op.13 = $20binary_subscr.9 >= $26binary_subscr.12 ['$20binary_subscr.9', '$26binary_subscr.12', '$28compare_op.13']\n",
            "    $30binary_and.14 = $14compare_op.6 & $28compare_op.13 ['$14compare_op.6', '$28compare_op.13', '$30binary_and.14']\n",
            "    $32return_value.15 = cast(value=$30binary_and.14) ['$30binary_and.14', '$32return_value.15']\n",
            "    return $32return_value.15                ['$32return_value.15']\n",
            "\n",
            "DEBUG:numba.core.byteflow:bytecode dump:\n",
            ">          0\tNOP(arg=None, lineno=1060)\n",
            "           2\tLOAD_FAST(arg=0, lineno=1060)\n",
            "           4\tLOAD_CONST(arg=1, lineno=1060)\n",
            "           6\tBINARY_SUBSCR(arg=None, lineno=1060)\n",
            "           8\tLOAD_FAST(arg=0, lineno=1060)\n",
            "          10\tLOAD_CONST(arg=2, lineno=1060)\n",
            "          12\tBINARY_SUBSCR(arg=None, lineno=1060)\n",
            "          14\tCOMPARE_OP(arg=0, lineno=1060)\n",
            "          16\tLOAD_FAST(arg=0, lineno=1060)\n",
            "          18\tLOAD_CONST(arg=1, lineno=1060)\n",
            "          20\tBINARY_SUBSCR(arg=None, lineno=1060)\n",
            "          22\tLOAD_FAST(arg=0, lineno=1060)\n",
            "          24\tLOAD_CONST(arg=3, lineno=1060)\n",
            "          26\tBINARY_SUBSCR(arg=None, lineno=1060)\n",
            "          28\tCOMPARE_OP(arg=1, lineno=1060)\n",
            "          30\tBINARY_AND(arg=None, lineno=1060)\n",
            "          32\tRETURN_VALUE(arg=None, lineno=1060)\n",
            "DEBUG:numba.core.byteflow:pending: deque([State(pc_initial=0 nstack_initial=0)])\n",
            "DEBUG:numba.core.byteflow:stack: []\n",
            "DEBUG:numba.core.byteflow:dispatch pc=0, inst=NOP(arg=None, lineno=1060)\n",
            "DEBUG:numba.core.byteflow:stack []\n",
            "DEBUG:numba.core.byteflow:dispatch pc=2, inst=LOAD_FAST(arg=0, lineno=1060)\n",
            "DEBUG:numba.core.byteflow:stack []\n",
            "DEBUG:numba.core.byteflow:dispatch pc=4, inst=LOAD_CONST(arg=1, lineno=1060)\n",
            "DEBUG:numba.core.byteflow:stack ['$x2.0']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=6, inst=BINARY_SUBSCR(arg=None, lineno=1060)\n",
            "DEBUG:numba.core.byteflow:stack ['$x2.0', '$const4.1']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=8, inst=LOAD_FAST(arg=0, lineno=1060)\n",
            "DEBUG:numba.core.byteflow:stack ['$6binary_subscr.2']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=10, inst=LOAD_CONST(arg=2, lineno=1060)\n",
            "DEBUG:numba.core.byteflow:stack ['$6binary_subscr.2', '$x8.3']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=12, inst=BINARY_SUBSCR(arg=None, lineno=1060)\n",
            "DEBUG:numba.core.byteflow:stack ['$6binary_subscr.2', '$x8.3', '$const10.4']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=14, inst=COMPARE_OP(arg=0, lineno=1060)\n",
            "DEBUG:numba.core.byteflow:stack ['$6binary_subscr.2', '$12binary_subscr.5']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=16, inst=LOAD_FAST(arg=0, lineno=1060)\n",
            "DEBUG:numba.core.byteflow:stack ['$14compare_op.6']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=18, inst=LOAD_CONST(arg=1, lineno=1060)\n",
            "DEBUG:numba.core.byteflow:stack ['$14compare_op.6', '$x16.7']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=20, inst=BINARY_SUBSCR(arg=None, lineno=1060)\n",
            "DEBUG:numba.core.byteflow:stack ['$14compare_op.6', '$x16.7', '$const18.8']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=22, inst=LOAD_FAST(arg=0, lineno=1060)\n",
            "DEBUG:numba.core.byteflow:stack ['$14compare_op.6', '$20binary_subscr.9']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=24, inst=LOAD_CONST(arg=3, lineno=1060)\n",
            "DEBUG:numba.core.byteflow:stack ['$14compare_op.6', '$20binary_subscr.9', '$x22.10']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=26, inst=BINARY_SUBSCR(arg=None, lineno=1060)\n",
            "DEBUG:numba.core.byteflow:stack ['$14compare_op.6', '$20binary_subscr.9', '$x22.10', '$const24.11']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=28, inst=COMPARE_OP(arg=1, lineno=1060)\n",
            "DEBUG:numba.core.byteflow:stack ['$14compare_op.6', '$20binary_subscr.9', '$26binary_subscr.12']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=30, inst=BINARY_AND(arg=None, lineno=1060)\n",
            "DEBUG:numba.core.byteflow:stack ['$14compare_op.6', '$28compare_op.13']\n",
            "DEBUG:numba.core.byteflow:dispatch pc=32, inst=RETURN_VALUE(arg=None, lineno=1060)\n",
            "DEBUG:numba.core.byteflow:stack ['$30binary_and.14']\n",
            "DEBUG:numba.core.byteflow:end state. edges=[]\n",
            "DEBUG:numba.core.byteflow:-------------------------Prune PHIs-------------------------\n",
            "DEBUG:numba.core.byteflow:Used_phis: defaultdict(<class 'set'>, {State(pc_initial=0 nstack_initial=0): set()})\n",
            "DEBUG:numba.core.byteflow:defmap: {}\n",
            "DEBUG:numba.core.byteflow:phismap: defaultdict(<class 'set'>, {})\n",
            "DEBUG:numba.core.byteflow:changing phismap: defaultdict(<class 'set'>, {})\n",
            "DEBUG:numba.core.byteflow:keep phismap: {}\n",
            "DEBUG:numba.core.byteflow:new_out: defaultdict(<class 'dict'>, {})\n",
            "DEBUG:numba.core.byteflow:----------------------DONE Prune PHIs-----------------------\n",
            "DEBUG:numba.core.byteflow:block_infos State(pc_initial=0 nstack_initial=0):\n",
            "AdaptBlockInfo(insts=((0, {}), (2, {'res': '$x2.0'}), (4, {'res': '$const4.1'}), (6, {'index': '$const4.1', 'target': '$x2.0', 'res': '$6binary_subscr.2'}), (8, {'res': '$x8.3'}), (10, {'res': '$const10.4'}), (12, {'index': '$const10.4', 'target': '$x8.3', 'res': '$12binary_subscr.5'}), (14, {'lhs': '$6binary_subscr.2', 'rhs': '$12binary_subscr.5', 'res': '$14compare_op.6'}), (16, {'res': '$x16.7'}), (18, {'res': '$const18.8'}), (20, {'index': '$const18.8', 'target': '$x16.7', 'res': '$20binary_subscr.9'}), (22, {'res': '$x22.10'}), (24, {'res': '$const24.11'}), (26, {'index': '$const24.11', 'target': '$x22.10', 'res': '$26binary_subscr.12'}), (28, {'lhs': '$20binary_subscr.9', 'rhs': '$26binary_subscr.12', 'res': '$28compare_op.13'}), (30, {'lhs': '$14compare_op.6', 'rhs': '$28compare_op.13', 'res': '$30binary_and.14'}), (32, {'retval': '$30binary_and.14', 'castval': '$32return_value.15'})), outgoing_phis={}, blockstack=(), active_try_block=None, outgoing_edgepushed={})\n",
            "DEBUG:numba.core.interpreter:label 0:\n",
            "    x = arg(0, name=x)                       ['x']\n",
            "    $const4.1 = const(int, 0)                ['$const4.1']\n",
            "    $6binary_subscr.2 = getitem(value=x, index=$const4.1, fn=<built-in function getitem>) ['$6binary_subscr.2', '$const4.1', 'x']\n",
            "    $const10.4 = const(int, -1)              ['$const10.4']\n",
            "    $12binary_subscr.5 = getitem(value=x, index=$const10.4, fn=<built-in function getitem>) ['$12binary_subscr.5', '$const10.4', 'x']\n",
            "    $14compare_op.6 = $6binary_subscr.2 < $12binary_subscr.5 ['$12binary_subscr.5', '$14compare_op.6', '$6binary_subscr.2']\n",
            "    $const18.8 = const(int, 0)               ['$const18.8']\n",
            "    $20binary_subscr.9 = getitem(value=x, index=$const18.8, fn=<built-in function getitem>) ['$20binary_subscr.9', '$const18.8', 'x']\n",
            "    $const24.11 = const(int, 1)              ['$const24.11']\n",
            "    $26binary_subscr.12 = getitem(value=x, index=$const24.11, fn=<built-in function getitem>) ['$26binary_subscr.12', '$const24.11', 'x']\n",
            "    $28compare_op.13 = $20binary_subscr.9 <= $26binary_subscr.12 ['$20binary_subscr.9', '$26binary_subscr.12', '$28compare_op.13']\n",
            "    $30binary_and.14 = $14compare_op.6 & $28compare_op.13 ['$14compare_op.6', '$28compare_op.13', '$30binary_and.14']\n",
            "    $32return_value.15 = cast(value=$30binary_and.14) ['$30binary_and.14', '$32return_value.15']\n",
            "    return $32return_value.15                ['$32return_value.15']\n",
            "\n",
            "Run inference with cuda\n",
            "load /home/zzy/tts_model_uig/uig-script_arabic/G_100000.pth\n",
            "text: بولىدۇ، بىز سىزنىڭ يېقىندىن بۇيان قىلىۋاتقان ئىشىڭىز توغرىسىدا پاراڭلىشايلى. خىزمەتمۇ ياكى ئۆگىنىشمۇ ياكى تۇرمۇشتىكى قىزىقارلىق ئىشلارمۇ؟ ياكى سىز يېقىندا قايسى قىزىقارلىق كىنولارنى كۆردىڭىز ياكى قايسى كىشىنى مەپتۇن قىلىدىغان كىتابلارنى ئوقۇدىڭىز؟ ياكى سىزنىڭ بىرەر قىزىقارلىق قىزىقىشىڭىز ۋە كەچۈرمىشىڭىز بار، ئورتاقلىشىشنى خالامسىز؟ بىز بۇ تېمىلارنى چىقىش قىلىپ، بۇ مەنىلىك، قىزىقارلىق مىنۇتلارنى بىرلىكتە ئۆتكۈزسەك بولىدۇ.\n",
            "text after filtering OOV: بولىدۇ بىز سىزنىڭ يېقىندىن بۇيان قىلىۋاتقان ئىشىڭىز توغرىسىدا پاراڭلىشايلى خىزمەتمۇ ياكى ئۆگىنىشمۇ ياكى تۇرمۇشتىكى قىزىقارلىق ئىشلارمۇ ياكى سىز يېقىندا قايسى قىزىقارلىق كىنولارنى كۆردىڭىز ياكى قايسى كىشىنى مەپتۇن قىلىدىغان كىتابلارنى ئوقۇدىڭىز ياكى سىزنىڭ بىرەر قىزىقارلىق قىزىقىشىڭىز ۋە كەچۈرمىشىڭىز بار ئورتاقلىشىشنى خالامسىز بىز بۇ تېمىلارنى چىقىش قىلىپ بۇ مەنىلىك قىزىقارلىق مىنۇتلارنى بىرلىكتە ئۆتكۈزسەك بولىدۇ\n",
            "wav: ./example.wav\n",
            "\u001b[0m"
          ]
        }
      ],
      "source": [
        "# run TTS inference\n",
        "# PYTHONPATH: path to vits\n",
        "# --model-dir: your model path\n",
        "! PYTHONPATH=$PYTHONPATH:/home/zzy/vits python infer/tts_infer.py --model-dir /home/zzy/tts_model_uig/uig-script_arabic \\\n",
        "--wav ./example.wav --txt \"بولىدۇ، بىز سىزنىڭ يېقىندىن بۇيان قىلىۋاتقان ئىشىڭىز توغرىسىدا پاراڭلىشايلى. خىزمەتمۇ ياكى ئۆگىنىشمۇ ياكى تۇرمۇشتىكى قىزىقارلىق ئىشلارمۇ؟ ياكى سىز يېقىندا قايسى قىزىقارلىق كىنولارنى كۆردىڭىز ياكى قايسى كىشىنى مەپتۇن قىلىدىغان كىتابلارنى ئوقۇدىڭىز؟ ياكى سىزنىڭ بىرەر قىزىقارلىق قىزىقىشىڭىز ۋە كەچۈرمىشىڭىز بار، ئورتاقلىشىشنى خالامسىز؟ بىز بۇ تېمىلارنى چىقىش قىلىپ، بۇ مەنىلىك، قىزىقارلىق مىنۇتلارنى بىرلىكتە ئۆتكۈزسەك بولىدۇ.\""
      ]
    }
  ],
  "metadata": {
    "accelerator": "GPU",
    "colab": {
      "gpuType": "T4",
      "provenance": []
    },
    "gpuClass": "standard",
    "kernelspec": {
      "display_name": "Python 3",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.8.16"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}
